package com.vislardo.app.notebook;

import com.vislardo.app.notebook.utils.AppConfigManager;
import com.vislardo.app.notebook.utils.DataManager;
import com.vislardo.app.notebook.utils.NoteFileManager;
import com.vislardo.app.notebook.view.LoginView;

import javax.swing.*;
import javax.xml.crypto.Data;

public class NotebookApplication {

    public static void main(String[] args) {
        if(!systemCheck())return;
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            e.printStackTrace();
        }

        // 初始化界面
        SwingUtilities.invokeLater(() -> new LoginView());
    }

    private static boolean systemCheck() {
        try{
            System.out.println("日记文件路径："+AppConfigManager.getInstance().getNoteFolderPath());
            System.out.println("临时文件路径："+AppConfigManager.getInstance().getTempFolderPath());
            System.out.println("数据文件路径："+AppConfigManager.getInstance().getDataFolderPath());

            DataManager.getInstance().dbcheck();

        }catch(Exception e){
            System.out.println("配置文件加载失败");
            e.printStackTrace();
            return false;
        }
        return true;
    }

}
